class CardBean {
  int code;
  int subCode;
  String msg;
  String msgCn;
  int processTime;
  Card card;
  List<Accounts> accounts;
  Profile profile;
  int codeAll;

  CardBean(
      {this.code,
      this.subCode,
      this.msg,
      this.msgCn,
      this.processTime,
      this.card,
      this.accounts,
      this.profile,
      this.codeAll});

  CardBean.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    subCode = json['sub_code'];
    msg = json['msg'];
    msgCn = json['msg_cn'];
   
    card = json['card'] != null ? new Card.fromJson(json['card']) : null;
    if (json['accounts'] != null) {
      accounts = new List<Accounts>();
      json['accounts'].forEach((v) {
        accounts.add(new Accounts.fromJson(v));
      });
    }
    profile =
        json['profile'] != null ? new Profile.fromJson(json['profile']) : null;
    codeAll = json['code_all'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['sub_code'] = this.subCode;
    data['msg'] = this.msg;
    data['msg_cn'] = this.msgCn;
    data['process_time'] = this.processTime;
    if (this.card != null) {
      data['card'] = this.card.toJson();
    }
    if (this.accounts != null) {
      data['accounts'] = this.accounts.map((v) => v.toJson()).toList();
    }
    if (this.profile != null) {
      data['profile'] = this.profile.toJson();
    }
    data['code_all'] = this.codeAll;
    return data;
  }
}

class Card {
  String id;
  String no;
  String type;
  Level level;
  String balance;
  String balanceUsable;
  String balanceCredited;
  String credited;
  String credit;
  String reward;
  String freeze;
  String discount;
  int requireProfile;
  int state;
  int byshop;
  String expireDate;
  int locked;
  String lockedMsg;
  String group;
  String accounts;
  String deposit;
  String feeIssue;
  String feeLoss;
  String totalConsum;
  String totalConsumCount;
  String totalCharge;
  String totalChargeCount;
  String totalChargeGift;
  String totalInvoice;

  Card(
      {this.id,
      this.no,
      this.type,
      this.level,
      this.balance,
      this.balanceUsable,
      this.balanceCredited,
      this.credited,
      this.credit,
      this.reward,
      this.freeze,
      this.discount,
      this.requireProfile,
      this.state,
      this.byshop,
      this.expireDate,
      this.locked,
      this.lockedMsg,
      this.group,
      this.accounts,
      this.deposit,
      this.feeIssue,
      this.feeLoss,
      this.totalConsum,
      this.totalConsumCount,
      this.totalCharge,
      this.totalChargeCount,
      this.totalChargeGift,
      this.totalInvoice});

  Card.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    no = json['no'];
    type = json['type'];
    level = json['level'] != null ? new Level.fromJson(json['level']) : null;
    balance = json['balance'];
    balanceUsable = json['balance_usable'];
    balanceCredited = json['balance_credited'];
    credited = json['credited'];
    credit = json['credit'];
    reward = json['reward'];
    freeze = json['freeze'];
    discount = json['discount'];
    requireProfile = json['require_profile'];
    state = json['state'];
    byshop = json['byshop'];
    expireDate = json['expire_date'];
    locked = json['locked'];
    lockedMsg = json['locked_msg'];
    group = json['group'];
    accounts = json['accounts'];
    deposit = json['deposit'];
    feeIssue = json['fee_issue'];
    feeLoss = json['fee_loss'];
    totalConsum = json['total_consum'];
    totalConsumCount = json['total_consum_count'];
    totalCharge = json['total_charge'];
    totalChargeCount = json['total_charge_count'];
    totalChargeGift = json['total_charge_gift'];
    totalInvoice = json['total_invoice'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['no'] = this.no;
    data['type'] = this.type;
    if (this.level != null) {
      data['level'] = this.level.toJson();
    }
    data['balance'] = this.balance;
    data['balance_usable'] = this.balanceUsable;
    data['balance_credited'] = this.balanceCredited;
    data['credited'] = this.credited;
    data['credit'] = this.credit;
    data['reward'] = this.reward;
    data['freeze'] = this.freeze;
    data['discount'] = this.discount;
    data['require_profile'] = this.requireProfile;
    data['state'] = this.state;
    data['byshop'] = this.byshop;
    data['expire_date'] = this.expireDate;
    data['locked'] = this.locked;
    data['locked_msg'] = this.lockedMsg;
    data['group'] = this.group;
    data['accounts'] = this.accounts;
    data['deposit'] = this.deposit;
    data['fee_issue'] = this.feeIssue;
    data['fee_loss'] = this.feeLoss;
    data['total_consum'] = this.totalConsum;
    data['total_consum_count'] = this.totalConsumCount;
    data['total_charge'] = this.totalCharge;
    data['total_charge_count'] = this.totalChargeCount;
    data['total_charge_gift'] = this.totalChargeGift;
    data['total_invoice'] = this.totalInvoice;
    return data;
  }
}

class Level {
  int id;
  String name;
  int amt;

  Level({this.id, this.name, this.amt});

  Level.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    amt = json['amt'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['amt'] = this.amt;
    return data;
  }
}

class Accounts {
  int i;
  String id;
  String no;
  String name;
  String balance;
  String freeze;
  String balanceUsable;
  String credited;
  int locked;
  String lockedMsg;
  String totalConsum;
  String totalConsumCount;
  String totalCharge;
  String totalChargeCount;
  String totalChargeGift;
  String totalInvoice;

  Accounts(
      {this.i,
      this.id,
      this.no,
      this.name,
      this.balance,
      this.freeze,
      this.balanceUsable,
      this.credited,
      this.locked,
      this.lockedMsg,
      this.totalConsum,
      this.totalConsumCount,
      this.totalCharge,
      this.totalChargeCount,
      this.totalChargeGift,
      this.totalInvoice});

  Accounts.fromJson(Map<String, dynamic> json) {
    i = json['i'];
    id = json['id'];
    no = json['no'];
    name = json['name'];
    balance = json['balance'];
    freeze = json['freeze'];
    balanceUsable = json['balance_usable'];
    credited = json['credited'];
    locked = json['locked'];
    lockedMsg = json['locked_msg'];
    totalConsum = json['total_consum'];
    totalConsumCount = json['total_consum_count'];
    totalCharge = json['total_charge'];
    totalChargeCount = json['total_charge_count'];
    totalChargeGift = json['total_charge_gift'];
    totalInvoice = json['total_invoice'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['i'] = this.i;
    data['id'] = this.id;
    data['no'] = this.no;
    data['name'] = this.name;
    data['balance'] = this.balance;
    data['freeze'] = this.freeze;
    data['balance_usable'] = this.balanceUsable;
    data['credited'] = this.credited;
    data['locked'] = this.locked;
    data['locked_msg'] = this.lockedMsg;
    data['total_consum'] = this.totalConsum;
    data['total_consum_count'] = this.totalConsumCount;
    data['total_charge'] = this.totalCharge;
    data['total_charge_count'] = this.totalChargeCount;
    data['total_charge_gift'] = this.totalChargeGift;
    data['total_invoice'] = this.totalInvoice;
    return data;
  }
}

class Profile {
  String mob;
  String name;
  int gender;
  String birthday;
  String tel;
  String addr;
  String city;
  String area;
  String road;
  int id;
  String idNo;
  String district;
  String remark;
  String remark1;
  String remark2;
  String remark3;
  String remark4;
  String remark5;
  Properties properties;

  Profile(
      {this.mob,
      this.name,
      this.gender,
      this.birthday,
      this.tel,
      this.addr,
      this.city,
      this.area,
      this.road,
      this.id,
      this.idNo,
      this.district,
      this.remark,
      this.remark1,
      this.remark2,
      this.remark3,
      this.remark4,
      this.remark5,
      this.properties});

  Profile.fromJson(Map<String, dynamic> json) {
    mob = json['mob'];
    name = json['name'];
    gender = json['gender'];
    birthday = json['birthday'];
    tel = json['tel'];
    addr = json['addr'];
    city = json['city'];
    area = json['area'];
    road = json['road'];
    id = json['id'];
    idNo = json['id_no'];
    district = json['district'];
    remark = json['remark'];
    remark1 = json['remark1'];
    remark2 = json['remark2'];
    remark3 = json['remark3'];
    remark4 = json['remark4'];
    remark5 = json['remark5'];
    properties = json['properties'] != null
        ? new Properties.fromJson(json['properties'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['mob'] = this.mob;
    data['name'] = this.name;
    data['gender'] = this.gender;
    data['birthday'] = this.birthday;
    data['tel'] = this.tel;
    data['addr'] = this.addr;
    data['city'] = this.city;
    data['area'] = this.area;
    data['road'] = this.road;
    data['id'] = this.id;
    data['id_no'] = this.idNo;
    data['district'] = this.district;
    data['remark'] = this.remark;
    data['remark1'] = this.remark1;
    data['remark2'] = this.remark2;
    data['remark3'] = this.remark3;
    data['remark4'] = this.remark4;
    data['remark5'] = this.remark5;
    if (this.properties != null) {
      data['properties'] = this.properties.toJson();
    }
    return data;
  }
}

class Properties {
  String exp1;
  String exp2;
  String exp3;
  String weight;
  String height;
  String workload;
  String healthcard;
  String card;
  String exp4;
  String exp5;
  String exp6;

  Properties(
      {this.exp1,
      this.exp2,
      this.exp3,
      this.weight,
      this.height,
      this.workload,
      this.healthcard,
      this.card,
      this.exp4,
      this.exp5,
      this.exp6});

  Properties.fromJson(Map<String, dynamic> json) {
    exp1 = json['exp1'];
    exp2 = json['exp2'];
    exp3 = json['exp3'];
    weight = json['weight'];
    height = json['height'];
    workload = json['workload'];
    healthcard = json['healthcard'];
    card = json['card'];
    exp4 = json['exp4'];
    exp5 = json['exp5'];
    exp6 = json['exp6'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['exp1'] = this.exp1;
    data['exp2'] = this.exp2;
    data['exp3'] = this.exp3;
    data['weight'] = this.weight;
    data['height'] = this.height;
    data['workload'] = this.workload;
    data['healthcard'] = this.healthcard;
    data['card'] = this.card;
    data['exp4'] = this.exp4;
    data['exp5'] = this.exp5;
    data['exp6'] = this.exp6;
    return data;
  }
}
